import { ArticleDetail, Comment } from '@/types/data'
import { ArticleDetailAction } from '@/types/store'

// 初始值
type State = {
  article: ArticleDetail,
  comment: Comment
}
const initState = {

  article: {}, // 详情
  comment: {}// 评论
} as State
console.log(initState)
export default function articleDetail (state = initState, action:ArticleDetailAction) {
  console.log(action)
  if (action.type === 'articleDetail/setArticleDetail') {
    return { ...state, article: action.payload }
  } else if (action.type === 'articleDetail/setCommentList') {
    return { ...state, comment: action.payload }
  }
  return state
}
